<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>唯爱薇o朝圣之路-异步操作</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/3.0.2/vue.global.js"></script>
</head>

<body>
    <div id="app"></div>
</body>
<script>
    const app = Vue.createApp({
        template: ` 
            <h1>唯爱薇o朝圣之路</h1>
            <!-- 同步组件 -->
            <syncComponent/>
            <!-- 异步组件 -->
            <asyncComponent/>

        `
    })
    app.component('syncComponent',{
        template:`<div>sync-同步-edu.vlovev.cn</div>`
    })
    app.component('asyncComponent',Vue.defineAsyncComponent(
                                            ()=>{
                                                return new Promise((resolve,reject) => {
                                                    setTimeout(()=>{
                                                        resolve({
                                                            template:`<div>async-异步-edu.vlovev.cn</div>`
                                                        })
                                                    },3000)
                                                })
                                            }
                                        )
                    )
      
    const vm = app.mount("#app")
</script>
